/*
    XTU OJ: 1352
    by: fifth_light
*/

#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>

int main(void) {
    int t;
    scanf("%d", &t);
    for(int i = 0; i < t; i++) {
        int64_t a, b;
        scanf("%" SCNd64 "%" SCNd64, &a, &b);
        int first = 1;
        while (a > 0) {
            int64_t i = (b % a == 0) ? (b / a) : (b / a + 1);
            if (first) {
                first = 0;
            } else {
                putchar(' ');
            }
            printf("%" PRId64, i);
            a = a * i - b;
            b = b * i;
        }
        putchar('\n');
    }
    return 0;
}
